<?php
/**
 * Created by PhpStorm.
 * User: zhangligang
 * Date: 17/4/22
 * Time: 下午2:14
 */

namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 购物车商品
 * Class CartGoods
 * @package App\Http\Models
 */
class CartGoods extends Model
{
    /**
     * table name
     * @var string
     */
    protected $table = 'app_cart_goods';

    protected $fillable = ['*'];

    /**
     * 关联购物车
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function cart()
    {
        return $this->belongsTo('App\Http\Models\Cart', 'cart_id');
    }

    /**
     * 关联商品
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function goods()
    {
        return $this->belongsTo('App\Http\Models\Goods', 'goods_id');
    }

}